<template>
	<view class="main">
		<view>
			<block v-if="dataList.length>0"></block>
			<entryItem v-for="(item,index) in dataList" :key="index" :data="item" @itemClick="itemClick"></entryItem>
			</block>
			<block v-if="dataList.length == 0">
				<view class="empty-img">
					<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/icon50.png"></image>
					<label>暂无内容</label>
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	import Index from '@/common/index-model.js'
	let index = new Index();
	export default {
		data() {
			return {
				dataList: [],
				orderId: ''
			}
		},
		onLoad(options) {
			this.orderId = options.orderId
			console.log('报名列表接收的数据', this.orderId)
			this.getEntryList(this.orderId)
		},
		methods: {
			itemClick(data) {
				console.log('点到我了', data.data)
				let token = uni.getStorageSync('token')
				if (token == "") {
					index.navigate_to('../../pagesC/login/login');
				} else {
					uni.makePhoneCall({
						phoneNumber: data.data.userPhone,
						success: function() {
							console.log('拨打电话成功！');
						},
						fail: function() {
							console.log('拨打电话失败！');
						}
					});
				}
			},
			getEntryList(orderId) {
				index.getPublicUserMember({
					"orderId": orderId
				}, 'orderUserRegister/list', 'get', res => {
					console.log('报名列表', res)
					if (res.data.success && res.data.code == 200) {
						this.dataList = res.data.result.records
					}
				})
			}
		}
	}
</script>

<style>

</style>
<style>
	@import url("@/static/css/publics.css");
</style>